package edu.ucla.whi.wanda;

import java.util.LinkedList;
import java.util.List;

import org.restlet.ext.wadl.ParameterInfo;
import org.restlet.ext.wadl.ParameterStyle;

public class MeasurementNewResource extends BaseNewResource {
	public static final String path = "/measurements/add";
	public static final String description = "Add a new Measreument";
	public static final String outputParamName = "Measurement";
	
	
	public MeasurementNewResource() {
		super(MEASUREMENTS_DOMAIN);
		
		initDescribe(path, description, outputParamName);
	}
	
	@Override
	protected List<ParameterInfo> postParams() {
		List<ParameterInfo> params = super.postParams();
		params.addAll(newParams());
		return params;
	}
	
	public static List<ParameterInfo> newParams() {
		List<ParameterInfo> params = new LinkedList<ParameterInfo>();
		
		// required
		params.add(new ParameterInfo("SubjectId", true, "xsd:string", ParameterStyle.QUERY, 
				"Subject's ID"));
		params.add(new ParameterInfo("SensorId", true, "xsd:string", ParameterStyle.QUERY, 
				"Sensor's ID"));
		params.add(new ParameterInfo("StartTime", true, "xsd:double", ParameterStyle.QUERY, 
				"Measurement start timestamp"));
		params.add(new ParameterInfo("EndTime", false, "xsd:double", ParameterStyle.QUERY, 
				"Measurement end timestamp"));
		params.add(new ParameterInfo("Value", true, "xsd:double", ParameterStyle.QUERY, 
				"Measurement value"));
		
		// optional
		params.add(new ParameterInfo("SamplingRate", false, "xsd:double", ParameterStyle.QUERY, 
				"Sampling rate in Hz"));
		
		return params;
	}
}